package com.iotechn.unimall.admin.api.distribution;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.annotation.param.Range;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.data.domain.DistributionBalanceDetailDO;
import com.iotechn.unimall.data.domain.DistributionDO;
import com.iotechn.unimall.data.dto.DistributionRankingDTO;
import com.iotechn.unimall.data.model.Page;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: rize
 * Date: 2019/11/27
 * Time: 11:09
 */
@HttpOpenApi(group = "admin.distribution", description = "分销服务")
public interface AdminDistributionService {

    @HttpMethod(description = "创建", permission = "operation:distribution:create", permissionParentName = "运营管理", permissionName = "分销管理")
    public String create(
            @NotNull @HttpParam(name = "userId", type = HttpParamType.COMMON, description = "欲提升为分销用户的ID") Long userId,
            @NotNull @Range(min = 1, max = 3) @HttpParam(name = "level", type = HttpParamType.COMMON, description = "分销等级 2、3") Integer level,
            @HttpParam(name = "parentId", type = HttpParamType.COMMON, description = "父分销用户Id", valueDef = "0") Long parentUserId,
            @HttpParam(name = "status", type = HttpParamType.COMMON, description = "状态", valueDef = "0") Integer status,
            @HttpParam(name = "realname", type = HttpParamType.COMMON, description = "真实姓名") String realname,
            @HttpParam(name = "idCard", type = HttpParamType.COMMON, description = "身份证") String idCard,
            @HttpParam(name = "allowChild", type = HttpParamType.COMMON, description = "allowChild", valueDef = "0") Integer allowChild,
            @HttpParam(name = "phone", type = HttpParamType.COMMON, description = "联系手机号") String phone,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "编辑", permission = "operation:distribution:edit", permissionParentName = "运营管理", permissionName = "分销管理")
    public String edit(
            @NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "分销用户Id") Long id,
            @HttpParam(name = "status", type = HttpParamType.COMMON, description = "状态", valueDef = "0") Integer status,
            @HttpParam(name = "realname", type = HttpParamType.COMMON, description = "真实姓名") String realname,
            @HttpParam(name = "idCard", type = HttpParamType.COMMON, description = "身份证") String idCard,
            @HttpParam(name = "allowChild", type = HttpParamType.COMMON, description = "allowChild", valueDef = "0") Integer allowChild,
            @HttpParam(name = "phone", type = HttpParamType.COMMON, description = "联系手机号") String phone,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "列表", permission = "operation:distribution:list", permissionParentName = "运营管理", permissionName = "分销管理")
    public Page<DistributionDO> list(
            @HttpParam(name = "page", type = HttpParamType.COMMON, description = "订单页码", valueDef = "1") Integer page,
            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit,
            @HttpParam(name = "level", type = HttpParamType.COMMON, description = "分销等级") Integer level,
            @HttpParam(name = "realname", type = HttpParamType.COMMON, description = "真实姓名") String realname,
            @HttpParam(name = "idCard", type = HttpParamType.COMMON, description = "身份证") String idCard,
            @HttpParam(name = "phone", type = HttpParamType.COMMON, description = "联系手机号") String phone,
            @HttpParam(name = "userId", type = HttpParamType.COMMON, description = "用户Id") Long userId,
            @HttpParam(name = "orderBy", type = HttpParamType.COMMON, description = "排序") String orderBy,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "删除", permission = "operation:distribution:delete", permissionParentName = "运营管理", permissionName = "分销管理")
    public String delete(
            @NotNull @HttpParam(name = "distributionId", type = HttpParamType.COMMON, description = "分销Id") Long distributionId,
            @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "排行榜", permission = "operation:distribution:rankinglist", permissionParentName = "运营管理", permissionName = "分销管理")
    public Page<DistributionRankingDTO> rankingList(
            @HttpParam(name = "page", type = HttpParamType.COMMON, description = "订单页码", valueDef = "1") Integer page,
            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "用户明细", permission = "operation:distribution:detail", permissionParentName = "运营管理", permissionName = "分销管理")
    public Page<DistributionBalanceDetailDO> detailPage(
            @NotNull @HttpParam(name = "distributionId", type = HttpParamType.COMMON, description = "分销id") Long distributionId,
            @HttpParam(name = "page", type = HttpParamType.COMMON, description = "订单页码", valueDef = "1") Integer page,
            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;
}
